package com.dopies.ecmobile.activity;

import org.json.JSONException;
import org.json.JSONObject;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;

import com.dopies.BeeFramework.activity.BaseActivity;
import com.dopies.BeeFramework.model.BusinessResponse;
import com.dopies.ecmobile.R;
import com.dopies.ecmobile.adapter.GoodPropertyAdapter;
import com.dopies.ecmobile.model.GoodDetailDraft;
import com.external.androidquery.callback.AjaxStatus;


public class GoodPropertyActivity extends BaseActivity implements BusinessResponse
{
    private ListView propertyListView;
    private GoodPropertyAdapter listAdapter;

    private TextView title;
    private ImageView back;

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.good_property_activity);

        title = (TextView) findViewById(R.id.top_view_text);
        title.setText(GoodDetailDraft.getInstance().goodDetail.goods_name);
        back = (ImageView) findViewById(R.id.top_view_back);
        back.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                finish();
            }
        });

        propertyListView = (ListView)findViewById(R.id.property_list);

        if(GoodDetailDraft.getInstance().goodDetail.properties.size() > 0) {
        	propertyListView.setVisibility(View.VISIBLE);
        	listAdapter = new GoodPropertyAdapter(this, GoodDetailDraft.getInstance().goodDetail.properties);
            propertyListView.setAdapter(listAdapter);
        } else {
        	propertyListView.setVisibility(View.GONE);
        }
        
        
    }

    @Override
    public void OnMessageResponse(String url, JSONObject jo, AjaxStatus status) throws JSONException {

    }
}
